package com.ricchieri.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.springframework.cache.annotation.Cacheable;

import com.ricchieri.dao.interf.IPhoneTypeDao;
import com.ricchieri.filter.BasicFilter;
import com.ricchieri.model.PhoneType;

public class PhoneTypeDao extends GenericDao implements IPhoneTypeDao {

	private static final long serialVersionUID = 5147169595891400663L;

	@SuppressWarnings("unchecked")
	@Override
	@Cacheable(value="phoneType")
	public List<PhoneType> getAllPhoneTypes(BasicFilter filter) {
		Criteria criteria = criteriaAllPhoneType(filter);
		
		return criteria.list();
	}
	
	private Criteria criteriaAllPhoneType(BasicFilter filter) {
		return super.criteriaAllBasic(filter, PhoneType.class);
	}	
	
	@Override
	protected String getTableName() {
		return "phoneType";
	}
}
